Skip to content

Add Java test gutter debugging - #332

Open
fwrq41251 wants to merge 1 commit into
zed-extensions:mainfrom
fwrq41251:feat/java-test-debug-locator
Open

fwrq41251 wants to merge 1 commit into
zed-extensions:mainfrom
fwrq41251:feat/java-test-debug-locator

Conversation

@fwrq41251

@fwrq41251 fwrq41251 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Refs #329. This follows #330, which added gutter debugging for Java main methods.

Changes

  • Add a Debug action for individual Java test methods and test classes, including nested classes, with JDTLS.
  • Generate a testTarget from the selected gutter task and defer test discovery and compilation until launch. The pinned Microsoft Java Test Runner is downloaded and loaded into JDTLS on demand.
  • Close the test result socket when the DAP connection ends. If the editor never connects, close both local listeners after 10 seconds.

Verification

  • 219 Rust tests passed. Formatting, Clippy, and release builds for the WASM extension and native Java proxy passed.
  • In a protocol test with JDTLS, test discovery became available after loading the bundles into the running server. DAP initialization succeeded through the relay, and both local ports closed after disconnect.
  • The Zed UI gutter-to-breakpoint and Stop flow remains to be verified end to end.

@cla-bot cla-bot Bot added the cla-signed label Nov 18, 2026
@fwrq41251
fwrq41251 force-pushed the feat/java-test-debug-locator branch from 1e5f341 to 18674dc Compare November 18, 2026 00:40

@tartarughina tartarughina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to test properly the behavior but something to be called out is the runtime injection for the test runner. I need to double check but it might not work as everything needs to be downloaded before JDTLS starts. This would mean that just on the first trial the runner won't be recognized by JDTLS.

Comment thread src/jdtls_server.rs
Comment on lines +103 to +107
let host = Path::new(&launcher)
.canonicalize()
.ok()
.and_then(|path| path.parent()?.parent().map(Path::to_path_buf))
.filter(|path| path.join("plugins").is_dir());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of this path traversal, it looks brittle

Comment thread src/test_debugger.rs
pub program_arguments: Vec<String>,
}

impl TestTarget {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some whitespace to split related portions of the code. A wall of text even in the world of agents is tough to go through

Comment thread src/test_debugger.rs
} else {
class
};
if !(0..=3).any(|kind| is_level(&item.test_kind, kind)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment explaining the reason for the iteration from 0 to 3?

Comment thread src/test_support.rs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As done for jdtls, the debugger and in general whenever in need of downloading something, please implement the trait Downloadable

Comment thread src/test_debugger.rs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is based on the VS Code implementation, then please add a comment pointing to that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants